import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
const loader = new GLTFLoader();
const model = new THREE.Group();
loader.load('/飞机.glb',(gltf)=>{
    const fly = new THREE.Group();
    fly.add(gltf.scene)
    fly.position.set(10,10,0);
    const axesHelper = new THREE.AxesHelper(10);
    fly.add(axesHelper)
    const quaternion = new THREE.Quaternion()
    // 飞机原本的方向
    const a = new THREE.Vector3(0,0,-1)
    // 旋转后的方向
    const b = new THREE.Vector3(-1,-1,-1).normalize()
    // 表示旋转向量a和b之间的角度
    quaternion.setFromUnitVectors(a,b)
    // 给飞机加上方向箭头
    const arrowHelper1  = new THREE.ArrowHelper(a,fly.position,10,0xffff00)  
    const arrowHelper2  = new THREE.ArrowHelper(b,fly.position,10,0xff00ff)  
    fly.quaternion.multiply(quaternion)
    model.add(arrowHelper1,arrowHelper2)

    model.add(fly);

})

export default {model};